-
Couldn't load subscription status.
- Fork 118
feat: allow visiting entire domain metadata #1384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@OussamaSaoudi @zachschuermann can I bother you for a review here? :) |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1384 +/- ##
==========================================
+ Coverage 84.65% 84.68% +0.03%
==========================================
Files 115 115
Lines 29557 29644 +87
Branches 29557 29644 +87
==========================================
+ Hits 25021 25104 +83
Misses 3329 3329
- Partials 1207 1211 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
74917e2 to
a27ad6f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! I think we should slightly change the APIs, but basically this is good
| key: KernelStringSlice, | ||
| value: KernelStringSlice, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call these domain and configuration to match the protocol. we should probably also include if the domain is removed
| .remove(domain) | ||
| .map(|domain_metadata| domain_metadata.configuration)) | ||
| } | ||
| pub(crate) fn all_domain_metadata_configuration( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a newline above
|
|
||
| pub(crate) type NullableCvoid = Option<NonNull<c_void>>; | ||
|
|
||
| #[derive(Default)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're not using CStringMap in this PR? Can we revert this change if it's not needed?
| pub(crate) fn all_domain_metadata_configuration( | ||
| log_segment: &LogSegment, | ||
| engine: &dyn Engine, | ||
| ) -> DeltaResult<HashMap<String, String>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit like an odd api. I'd prefer to return a Vec<DomainMetadata> where:
struct DomainMetadata {
domain: String,
configuration: String,
removed: bool,
}
We already have exactly this type in actions/mod.rs but it's #[internal_api]. I think we should just make the get_all_domain_metadata in Snapshot also #[internal_api], we already enable that feature in the ffi crate.
What changes are proposed in this pull request?
Adding the ability to scan the entire domain metadata. This PR is in a way a follow up to #1342. I wanted to use the
visit_string_mapfunction from that PR, but then we would run into some ownership/lifetime issues: we would need to return a pointer to a kernel-allocated mapI thought the nicest solution would be to just create a separate visitor function which avoids any lifetime issues by scoping things to the visitor callback.
I also considered:
Which would allow reusing the
visit_string_mapfunction and make this more in line with how engine is expected to consume other string maps, but I don't think the extra level of indirection really adds much and the visitor is very simple anyway.This PR affects the following public APIs
Snapshot::get_all_domain_metadatafunctionvisit_domain_metadatato go over all domain metadataHow was this change tested?
kernel::snapshot::tests::test_domain_metadatatestffi::domain_metadata::tests::test_domain_metadatatest